package com.yhl.log.controller;

import cn.hutool.json.JSONObject;
import com.yhl.log.entity.GoodsBill;
import com.yhl.log.service.GoodsBillService;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpSession;

    import org.springframework.stereotype.Controller;


import java.util.List;
import javax.servlet.http.HttpSession;
/**
*
* @author YaoHongli
* @since 2023-08-07 16:31:26
*/

    @Controller
public class GoodsBillController {


    @Autowired
    private GoodsBillService goodsBillService;

    @RequestMapping("/goodsBillList")
    public String goodsBillList(Model model) {
        List<GoodsBill> goodsList = goodsBillService.getGoodsList();
        model.addAttribute("list",goodsList);
        return "/goodsBillList";
    }


    @RequestMapping("/addGoodsBill")
    @ResponseBody
    public String addGoodsBill(@RequestBody GoodsBill goodsBill){
        goodsBillService.addGoodsBill(goodsBill);
        return goodsBill.toString();
    }

    @GetMapping("/int")
    public int add(Integer id) {
        return id;
    }

//    @RequestMapping("jsp/updateGoodsBill.do")
//    public String updateGoodsBill(GoodsBill goodsBill){
//             goodsBillService.updateGoodsBill(goodsBill);
//             return "redirect:/goodsBillList.do";
//    }
//
//
    @RequestMapping("/delete")
    @ResponseBody
    public void deleteGoodsBill(String id) {
        goodsBillService.deleteGoodsBill(id);
    }
}